<?php


namespace App\Service\System;


use App\Facade\AppContext;
use App\Models\System\Group;
use App\Models\System\Role;

class RoleService
{
    function lis($all = false)
    {
        $query = Role::query()
            ->select('name', 'id', 'group_code');
        if (!$all) {
            $query->where('group_code', '<>', Group::MEMBER);
        }
        return $query->get();
    }

    function default($group)
    {
        return Role::query()
            ->where('group_code', '=', $group)
            ->orderBy('id')
            ->value('id');
    }
}
